<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>推广码管理</title>
    <?php require 'templates/common/head.html'; ?>
    <style type="text/css">
        .divleft{width: 13%; float: left; text-align:left; border-right: solid 1px #d5d5d5; margin-right: 2% }
        .divleft2{width: 8%; float: left; text-align:left; border-right: solid 1px #d5d5d5; margin-right: 2% }
        .divright{ width: 12%; float:right; text-align: right;}
    </style>
</head>
<body>
<div class="container-fluid">
    <?php require 'templates/common/nav.html'; ?>
    <div class="panel panel-primary">
        <div class="panel-heading text-center"><h3 class="panel-title">推广码管理</h3></div>
        <div class="panel-body">
            <div class="panel-group"   id="accordion" role="tablist" aria-multiselectable="true">
                <form action="" method="post" onsubmit="return checkdata()">
                    <input type="text" name="stime" placeholder="开始日期" id="stime" value="<?php echo Empty($_POST['stime']) ? Date('Y-m-d') : $_POST['stime']; ?>" readonly> -
                    <input type="text" placeholder="结束日期" id="etime" name="etime" readonly value="<?php echo Empty($_POST['etime']) ? Date('Y-m-d') : $_POST['etime']; ?>">&nbsp;&nbsp;
                    <input type="submit" value="查询">
                </form><br/><br/>

                <div class="panel panel-default" >
                    <div class="panel-heading" style="background-color:#d5d5d5" >
                        <div class="row">
                            <div class="col-xs-4 text-justify" style="width:100%;">
                                <div class="divleft"><b  >用户名</b></div>
                                <div class="divleft2" > <b >认证</b></div>
                                <div class="divleft2" > <b >联系电话</b></div>
                                <div class="divleft2" > <b >关注状态</b></div>
                                <div class="divleft" > <b >关注时间</b></div>
                                <div class="divleft" > <b >取消关注时间</b></div>
                                <div class="divright" > <b >用户状态</b></div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="panel panel-default">
                    <?php foreach($infos as $key => $value):?>
                        <div class="panel-heading"  style=" <?php if($key%2==0){echo "background-color:#DFF0D8;";}else{ echo "border-top: solid 2px #ffffff;";}?>">
                            <div class="row">
                                <div class="col-xs-4 text-justify" style="width:100%;">

                                    <div class="divleft">
                                        <span><?=$value['name']?></span>
                                    </div>
                                    <div class="divleft2">
                                        <span ><?php  if($value['认证']>1)echo "已认证";else echo "未认证" ; ?></span>
                                    </div>
                                    <div class="divleft2">
                                        <span >&nbsp;<?php echo  $value['telephone']; ?></span>
                                    </div>
                                    <div class="divleft2">
                                        <span ><?php  if($value['unsubscribe']==0)echo "已关注";else echo "已取关" ; ?></span>
                                    </div>
                                    <div class="divleft">
                                        <span >&nbsp;<?php echo  $value['regist_time']; ?></span>
                                    </div>
                                    <div class="divleft">
                                        <span >&nbsp;<?php echo  $value['unsubscribe_time']; ?></span>
                                    </div>
                                    <div class="divright">
                                        <span ><?php  if($value['是否正常']==2)echo "已被禁用";else echo "正常" ; ?></span>
                                    </div>

                                </div>
                            </div>
                        </div>
                    <?php endforeach; ?>

                </div>
            </div>
        </div>
    <div><?= $page->showpage();?></div>
    </div>

</div>
<script>
    //时间控件
    Calendar.setup({
        inputField : "stime",
        ifFormat : "%Y-%m-%d",
        showsTime : "true",
        timeFormat : "24"
    });

    Calendar.setup({
        inputField : "etime",
        ifFormat : "%Y-%m-%d",
        showsTime : "true",
        timeFormat : "24"
    });

    function checkdata() {
        var stime = $('input[name="stime"]').val();
        var etime = $('input[name="etime"]').val();

        if(stime == '') {
            alert('开始日期不能为空!');
            return false;
        }
        if(etime == '') {
            alert('结束日期不能为空!');
            return false;
        }

        var arrStart = stime.split("-");
        var tmpIntStartYear = parseInt(arrStart[0],10);
        var tmpIntStartMonth = parseInt(arrStart[1],10);
        var tmpIntStartDay = parseInt(arrStart[2],10);

        var arrEnd = etime.split("-");
        var tmpIntEndYear = parseInt(arrEnd[0],10);
        var tmpIntEndMonth = parseInt(arrEnd[1],10);
        var tmpIntEndDay = parseInt(arrEnd[2],10);

        if(tmpIntStartYear > tmpIntEndYear) {
            alert("开始日期不能晚于结束日期");
            return false;
        }

        if(tmpIntStartYear == tmpIntEndYear) {
            if(tmpIntStartMonth > tmpIntEndMonth) {
                alert("开始日期不能晚于结束日期");
                return false;
            }
        }
        if(tmpIntStartYear == tmpIntEndYear) {
            if(tmpIntStartMonth == tmpIntEndMonth) {

                if(tmpIntStartDay > tmpIntEndDay) {
                    alert("开始日期不能晚于结束日期");
                    return false;
                }
            }
        }
    }
</script>
<?php require 'templates/common/foot.html'; ?>
</body>
</html>